package com.nursing.service;

import com.github.pagehelper.PageInfo;
import com.nursing.Dao.CarePlanDao;
import com.nursing.bean.CarePlan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

@Service
public class CarePlanService {
    private final CarePlanDao carePlanDao;

    @Autowired
    public CarePlanService(CarePlanDao carePlanDao) {
        this.carePlanDao = carePlanDao;
    }

    public void deleteCarePlan(Integer id) {
        carePlanDao.delete(id);
    }

    public void updateCarePlan(CarePlan carePlan) {
        carePlanDao.update(carePlan);
    }

    public void addCarePlan(CarePlan carePlan) {
        carePlan.setCreatedAt(LocalDateTime.now());
        carePlan.setStatus(0); // 初始化设置为未分配
        carePlanDao.insert(carePlan);
    }

    public CarePlan getCarePlanById(Integer id) {
        return carePlanDao.getById(id);
    }




}
